<template>
  <wd-card custom-title-class="p-2!" custom-footer-class="p-2! shadow-lg rounded-lg">
    <view class="text-right text-red-5">
      <text>{{ order.status }}</text>
    </view>
    <view class="my-3 bg-neutral-2 h-[1px]"></view>
    <view class="flex">
      <view>
        <wd-img :width="75" :height="75" src="/static/images/product001.png" />
      </view>
      <view class="flex">
        <view class="flex flex-col">
          <text class="text-neutral-9 text-xs">{{ order.goods_list.name }}</text>
          <text class="text-xs">{{ order.goods_list.sku }}</text>
        </view>
        <view class="flex flex-col flex-shrink-0 justify-center items-end">
          <text class="text-neutral-9">¥ {{ order.goods_list.price }}</text>
          <text>x{{ order.goods_list.count }}</text>
        </view>
      </view>
    </view>
    <!-- 订单编号 -->
    <view class="text-neutral-5 mt-3 text-xs">
      <text>订单编号 {{ order.order_no }}</text>
    </view>
    <view class="my-3 bg-neutral-2 h-[1px]"></view>
    <!-- 数量和价钱 -->
    <view class="flex flex-col gap-4 text-neutral-7 py-2" style="align-items: flex-end">
      <text>共1件商品, 实付款: ¥{{ order.goods_list.price * order.goods_list.count }}</text>
      <wd-button v-if="order.status !== '待评价'" class="m-0" @click="to">
        {{ order.status === '待支付' ? '立即付款' : '确认收货' }}
      </wd-button>
    </view>
  </wd-card>
</template>

<script lang="ts" setup>
const props = defineProps(['order'])
const emit = defineEmits(['handleButton']);
// const order = ref<order>()

const to = () => {
	if(props.order.status === '待支付'){
		uni.navigateTo({
			url: '/pages/order-pay/order-pay' // 跳转到对应路径的页面
		});
	}else{
		emit('handleButton',props.order._id)
		// updateOrderStatus()
	}
	
}
</script>

<style lang="scss" scoped>
//
</style>
